<?php
#基础函数
include_once('_path.php');

#db
include_once(_CONST_LOCAL_INCLUDE_PATH."database.class.php");
$database = new Database($db_vars);

if ($db_slave_vars['hostname'] != '') {
	$slave = new Database($db_slave_vars);
} else {
	$slave =& $database;
}

#通用函数
include_once(_CONST_LOCAL_INCLUDE_PATH."common.php");

#page
#翻页
$page = trim($_GET['page']) + 0;
$pagesize = 20;

#!!翻页
if ($page < 1) $page = 1;

#总共数量
$rs_count = $database->queryArray("SELECT count(*) total FROM news");
$total_page = ceil($rs_count[0]["total"] / $pagesize);
if ($total_page < 1) $total_page = 1;
if ($page > $total_page) $page = $total_page;

#正式查询
$rsc = $database->queryArray("SELECT * FROM news order by dateline DESC  LIMIT ".(($page - 1) * $pagesize).", $pagesize");
?>
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
	<title>新闻-Haiersi•GL-海尔斯管历健康服务网</title>
	<link href="media/css/reset.css" rel="stylesheet" type="text/css"/>
	<link href="media/css/base.css" rel="stylesheet" type="text/css"/>
	<script type="text/javascript" src="media/js/jquery-1.4.2.min.js"></script>
</head>
<body>
<div class="wrapper">
	<div class="header clearfix">
		<a  class="logo fl" href="index.html"><h1>Hesgl</h1></a>
		<ul class="nav fr clearfix">
			<li><a href="index.html">首页</a></li>
			<li><a href="about-us.html">关于我们</a></li>
			<li><a href="services.html">我们的服务</a></li>
			<li><a href="approach.html">我们的方法</a></li>
			<li><a href="health.html">企业健康管理</a></li>
			<li class="cur"><a href="news.html">新闻</a></li>
			<li class="last"><a href="contacts.html">联系我们</a></li>
		</ul>
	</div>

    <div class="content clearfix">
        <div class="main news">
			<div class="box-con">
				<ul class="news-list">
                                <?php
                                for($i=0;$i<sizeof($rsc);$i++){
                                $r = $rsc[$i];
                                ?>
					<li><a href="news-detail.php?nid=<?=$r['id']?>" target="_blank"><?=$r['title']?></a><span><?=date("Y年m月d日",$r['dateline'])?></span></li>
                               <?php
                                }
                                ?>
				</ul>
				<div class="digg">
                                     <? pagination($page, $pagesize, $rs_count[0]["total"], "news.php&page=%s%") ?>
                                </div>
			</div>
        </div>

    </div>
	<div class="footer">
	    <p class="copyright">Copyright © 2011 Hesgl.com All Rights Reserved</p>
	</div>
</div>
</body>
</html>
